# -*- coding: utf-8 -*-
# @Time    : 2023/6/5 9:13
# @Author  : hy
# @Email   : 1596096369@qq.com
# @File    : diagnosis_page.py
# @Software: PyCharm
from pages.base_page import BasePage
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from appium.webdriver.common.mobileby import MobileBy as By

class DiagnosisPage(BasePage):
    start_diagnosis_locater = (By.XPATH,'//*[@resource-id="com.xiachufang:id/text_begin"]')
    zhenduan_finish_locater = (By.XPATH,'//*[@resource-id="android:id/alertTitle"]')
    #开始诊断
    def start_diagnosis(self):
        self.find_element(self.start_diagnosis_locater).click()
        wait = WebDriverWait(self.driver, 30, 0.5)
        wait.until(EC.presence_of_all_elements_located(self.zhenduan_finish_locater))

    # 获取网络诊断弹框文本
    def get_diagnosis_text(self):
        return self.find_element(self.zhenduan_finish_locater).text